<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="viewport"
        content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
    <link rel="stylesheet" href="<?php echo base_url().'public/home/' ?>css/general.css">
    <link rel="stylesheet" href="<?php echo base_url().'public/home/' ?>css/record.css">
    <script src="<?php echo base_url().'public/home/' ?>js/jquery-2.0.3.min.js"></script>
    <title>督导教学听课记录</title>
</head>

<body>

    <div class="min">
      <input type="hidden" name="admin_id" id="admin_id" value="<?php echo $_SESSION[SESS_USER_HOME]['id'] ?>">
      <input type="hidden" name="url" id="url" value="<?php echo base_url() ?>">
       
    </div>

     <div class="loading" style="text-align:center;"><img src="<?php echo base_url().'public/home/' ?>images/loading1.gif"></div>
    <div class="tip" style="display: none;text-align:center;color: #5d5d5d;height: 30px;line-height:30px;">到底了,没有数据了~</div>




<script>
    // let listen_id = $('#listen_type').val();
    let pageNo = 1;
    let pageSize = 20;
    let have = true;
    $(function () {
        getList();
        $(window).scroll(function(){
            // scroll at bottom
            if ($(window).scrollTop() + $(window).height() == $(document).height()) {
                pageNo++;
                getList()
            }
        });
    })

    function getList(){
        if(have){
            $.ajax({
                url: $("#url").val()+"/Home/Attend/teachingEvaluationList",
                dataType: "json",
                type: "post",
                data: {
                    pageNo: pageNo,
                    pageSize: pageSize,
                    admin_id: $("#admin_id").val(),
                    
                },
                success: function (data) {
                    let t = JSON.parse(data.v);
                    console.log(t);
                    let html =''

                if(status = true){
                    
                    $.each(t.ret, function (k, v) {
                        let a = (pageNo-1)*pageSize+(k+1) + '.' ;


                        html +=`
                        <div class="fk" id="fk" onclick="detail(${v.id})">
                            <div class="name">
                                <p class="sz" style="display: inline;">${a}</p>
                                <p style="display: inline;margin-left:1%;">${v.class_name}</p>
                                <div class="rtl" style="color: #3577F7;display: inline-block;margin-right: 5%;float:right;">
                                    <img src="<?php echo base_url().'public/home/' ?>images/score.png">
                                    <span id="results">${v.score}</span>分
                                </div>
                            </div>
                            <div class="ctg">
                                <div class="category" id="category">
                                    <span>${v.listen_type == null ? '暂无' : v.listen_type}</span>
                                    <span>${v.attendType == null ? '暂无' : v.attendType}</span>
                                </div>
                            </div>
                            <div class="datas"><span>${v.created}</span></div>
                            </div>
                        </div>`
                        // $('.min').append(html);
                    });
                        // 判断是否还有数据
                    if(pageNo==t.totalPage){
                        have=false
                        $(".loading").hide();
                        $(".tip").show();
                    }else if(pageNo>t.totalPage){
                         have=false
                         $(".loading").hide();
                         $(".tip").show();
                    }
                    $('.min').append(html);
                    
                    }else if(status = false){
                        $(".loading").hide();
                            $(".tip").show();
                        }
                },
            });
        }
    }


function detail (aid){
     console.log(aid);
    window.location.href = `<?php echo base_url() . 'Home/Attend/details?aid='?>${aid}`;//传id参数
}






</script> 


</body>

</html>